<template>
  <div class="welcome-container">
    <!-- 页面标题区域 -->
    <div class="welcome-header">
      <h1 class="welcome-title">欢迎使用羽你同行-羽毛球装备管理系统</h1>
      <p class="welcome-desc">高效管理装备信息，助力羽毛球运动数字化</p>
    </div>

    <!-- 功能快捷入口区域 -->
    <div class="function-cards">
      <!-- 商品页面入口 -->
      <div class="function-card" @click="toPage('/buy')">
        <div class="card-icon">
          <el-icon size="32"><ShoppingBag /></el-icon>
        </div>
        <div class="card-content">
          <h3>商品页面</h3>
          <p>浏览和选购各类羽毛球装备</p>
        </div>
      </div>

      <!-- 购物车入口 -->
      <div class="function-card" @click="toPage('/mycar')">
        <div class="card-icon">
          <el-icon size="32"><ShoppingCart /></el-icon>
        </div>
        <div class="card-content">
          <h3>我的购物车</h3>
          <p>查看和管理已添加的商品</p>
        </div>
      </div>
    </div>

    <!-- 底部装饰区域 -->
    <div class="welcome-footer">
      <p class="footer-text">羽你同行，让装备管理更简单</p>
    </div>
  </div>
</template>

<script setup>
// 导入图标（与主页菜单使用的图标保持一致）
import { ShoppingBag, ShoppingCart } from '@element-plus/icons-vue';
// 导入 Vue 实例获取方法
import { getCurrentInstance } from 'vue';

// 获取组件实例，通过 proxy 访问路由
const instance = getCurrentInstance();
const $router = instance.proxy.$router;

// 页面跳转方法
const toPage = (path) => {
  $router.push(path);
};
</script>

<style scoped>
.welcome-container {
  width: 100%;
  min-height: 100%;
  padding: 30px 50px;
  box-sizing: border-box;
}

/* 标题区域样式 */
.welcome-header {
  text-align: center;
  margin-bottom: 50px;
  padding: 20px 0;
  border-bottom: 2px solid #EFC3CA;
}

.welcome-title {
  font-size: 32px;
  color: #060270;
  margin-bottom: 15px;
  font-weight: 700;
}

.welcome-desc {
  font-size: 18px;
  color: #666;
  letter-spacing: 0.5px;
}

/* 功能卡片区域样式 */
.function-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  margin-bottom: 60px;
}

.function-card {
  background-color: #fff;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 4px 12px rgba(6, 2, 112, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
}

.function-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(6, 2, 112, 0.15);
}

.card-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: rgba(6, 2, 112, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 20px;
  color: #060270;
}

.card-content h3 {
  font-size: 20px;
  color: #060270;
  margin-bottom: 10px;
}

.card-content p {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
}

/* 底部区域样式 */
.welcome-footer {
  text-align: center;
  padding: 20px 0;
}

.footer-text {
  font-size: 16px;
  color: #060270;
  letter-spacing: 1px;
}
</style>